from app.core.config import DASHSCOPE_API_KEY, DASHSCOPE_BASE_URL
from openai import OpenAI

client = OpenAI(api_key=DASHSCOPE_API_KEY, base_url=DASHSCOPE_BASE_URL)

def chat_with_qwen(prompt: str) -> str:
    res = client.chat.completions.create(
        model="qwen-plus",
        messages=[
            {"role": "system", "content": "你是一个直播话术助手"},
            {"role": "user", "content": prompt},
        ]
    )
    return res.choices[0].message.content
